<div id="upload_popup">
	<h2>Upload file(s)</h2>
	<div class="content">
		<div class="form300">
			<?= Phpr_Form::openTag() ?>
			
				<p>Please click the link below to select files. You can upload up to 1000 files at a time.</p>
				
				<div class="form">
					<ul class="formElements">
						<li class="field checkbox full">
							<label for="uploader_override_files">
								Overwrite existing files
							</label>

							<div class="fieldContainer">
								<input type="checkbox" class="checkbox" value="1" name="override_files" id="uploader_override_files"/>
							</div>
							<div class="clear"/>
						</li>
					</ul>
				</div>

				<div class="addFileLink" id="file_uploader">
					<div id="select_files_container" class="invisible">
						<a href="#" id="file_upload_link">Select file(s)</a>
						<div class="progressInfo">
							<img class="overall-progress progress invisible" src="phproad/modules/db/behaviors/db_formbehavior/resources/images/progressbar.gif"/>
						</div>
					</div>
					<div class="upload_files_loading_indicator" id="upload_files_loading_indicator"><p class="loading">Loading...</p></div>
				</div>
				
				<div class="uploaderContainer" id="file_upload_container"></div>

				<script type="text/javascript">
					$('upload_popup').addEvent('popupLoaded', function(){
						new FileUploader('file_uploader', {
							'url': $('file_browser_current_url').value, 
							'container': $('file_upload_container'), 
							'target': 'file_upload_link',
							'data': $('file_upload_container').getForm(),
							'limitFiles': 1000,
							'onLoad': function(){ 
								$('upload_files_loading_indicator').hide();
								$('select_files_container').removeClass('invisible');
							},
							'onUploadComplete': function(){
								cancelPopup();
								$('file_browser').getForm().sendPhpr($('file_browser_navigate_handler').value, 
									{extraFields: {path: $('file_browser_current_path').value}, 
									update: 'multi', 
									onBeforePost: LightLoadingIndicator.show.pass('Loading...'), 
									onComplete: LightLoadingIndicator.hide,
									loadIndicator: {show: false}});
							}
						});
					});
				</script>
				
				<div class="offsetTop">
					<?= backend_button('Cancel', array('onclick'=>'return cancelPopup()')) ?>
				</div>
				<input type="hidden" id="rename_file_path" name="file_path" value="<?= h($file_path) ?>"/>

				<div class="clear"></div>
			</form>
		</div>
	</div>
</div>